// 资讯下面的tab栏
import React, { Component } from 'react'
import { Tabs } from 'antd-mobile';
import HomeNewsList from './HomeNewsList'
import axios from 'axios';

export default class HomeTabNews extends Component {
    state = {
        tabs: [],
        contents: []
    }
    componentDidMount() {
        axios.get('/data/tabList.json').then(res => {
            let { data } = res
            // console.log(data);
            this.setState({
                tabs: data.tabs,
                contents: data.contents
            })
        })
    }
    render() {
        return (
            <div>
                <Tabs tabs={this.state.tabs}
                    initialPage={1}
                >
                    {
                        this.state.contents.map((item, index) => <HomeNewsList key={index} contentArr={item} />)
                    }
                </Tabs>
            </div>
        )
    }
}
